package unitTool;

public class JsonRsp {
    private String msg;
    private int code;
    private long total;
    private Object rows;

    private JsonRsp(Object rows, String msg, int code){
        this.code =code;
        this.msg = msg;
        this.rows = rows;
    }

    public static JsonRsp success(Object data){
        return success(data,"");
    }

    public static JsonRsp success(Object data, String msg){
        return redate(data, msg,200);
    }

    public static JsonRsp fail(int code,String msg){
        return redate(null,msg,code);
    }

    private static JsonRsp redate(Object data, String msg, int code){
        return new JsonRsp(data,msg,code);
    }

    public String getMsg() {
        return msg;
    }

    public int getCode() {
        return code;
    }

    public Object getRows() {
        return rows;
    }

    public long getTotal() {
        return total;
    }

    public JsonRsp setTotal(long total){
        this.total = total;
        return this;
    }
}
